using System.Collections.Generic;
using Character;
using Consts;
using Dto;
using Newtonsoft.Json;
using UI;

namespace Net.Handler
{
    public class FightHandler : HandlerBase
    {
        public override void OnReceive(ResBase resBase)
        {
            switch (resBase.subCode)
            {
                case FightCodeConst.GET_CARD_SRES:
                    getCards(resBase);
                    break;
            }
        }

        private void getCards(ResBase resBase)
        {
            List<CardDto> cardList = JsonConvert.DeserializeObject<List<CardDto>>(resBase.result.ToString());
            Dispatch(AreaCode.CHARACTER,CharacterEvent.INIT_MY_CARD,cardList);
            Dispatch(AreaCode.CHARACTER,CharacterEvent.INIT_LEFT_CATD,null);
            Dispatch(AreaCode.CHARACTER,CharacterEvent.INIT_RIGHT_CATD,null);

            // 给自己玩家创建牌的对象
            // 改变倍数
            Dispatch(AreaCode.UI,UIEvent.CHANGE_MUTIPLE,1);
            
            

        }
    }
}